home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / ka9q / kit_src / field.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-03  |  2.4 KB  |  74 lines

  1. /*    (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
  2.  * 
  3.  *    Redistribution and use in source and binary forms are permitted for
  4.  *    non-commercial use, provided that the above copyright notice and this
  5.  *    paragraph are duplicated in all such forms.  THIS SOFTWARE IS PROVIDED
  6.  *    ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  7.  *    WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
  8.  *    FITNESS FOR A PARTICULAR PURPOSE.
  9.  */
  10. /*bdoc
  11.  *    Function "FIELD"
  12.  *
  13.  *    Written:  Dave Fritsche
  14.  *    Date:  July, 1987
  15.  *
  16.  *    This function will display an input field prompt (with attributes),
  17.  *    paint the initial input field (with attributes), accept input from
  18.  *    the keyboard according to the field template, reprint the input
  19.  *    field (with final attributes) upon input completion, reprint the prompt
  20.  *    field (with final attributes), and return the completion function code.
  21.  *    Syntax:
  22.  *        stat = field(tx, ty, tas, taf, title, ix, iy, ias,
  23.  *                 iaf, ilinep, ilinet, ilined, rmask)
  24.  *    Where:
  25.  *        tx,ty -- Integer coordinates for beginning of field title
  26.  *        tas,taf -- Integer (S)tarting & (F)inishing attribute for title
  27.  *        title -- Title string
  28.  *        ix,iy -- Integer coordinates for beginning of input field
  29.  *        ias,iaf -- Integer (S)tarting & (F)inishing attribute for
  30.  *               input field
  31.  *        ilinep -- String containing initial input field (no data)
  32.  *        ilinet -- String containing input field template (see inputdb())
  33.  *        ilined -- String containing input string returned by "inputdb()"
  34.  *        rmask -- Char byte with functions enabled for legal return
  35.  *            1 -- UP arrow
  36.  *            2 -- DOWN arrow
  37.  *            4 -- SHIFT-TAB
  38.  *            8 -- TAB
  39.  *            16 -- <CR>
  40.  *            32 -- <ESC>
  41.  *            64 -- "F1"
  42.  *            128 -- "F2"
  43.  *        stat -- Integer function number that ended input
  44.  edoc*/
  45.  
  46. #include <stdio.h>
  47.  
  48. int field(tx,ty,tas,taf,title,ix,iy,ias,iaf,ilinep,ilinet,ilined,rmask)
  49. int tx,ty,tas,taf,ix,iy,ias,iaf,rmask;
  50. char title[], ilinep[], ilinet[], ilined[];
  51. {
  52.     int stat, n;
  53.  
  54.     stat = 0;
  55.     puttxt(tx, ty, tas, 0, title);
  56.     puttxt(ix, iy, ias, ias, ilinep);
  57.     while ( (stat & rmask) == 0)
  58.     {
  59.         putcur(ix, iy);
  60. /*
  61.  *        stat = input(ilinet, ilined);
  62.  */
  63.         stat = inputdb(ilinet, ilined);
  64.         if ( (stat & rmask) == 0)
  65.             printf("%c", 7);
  66.     }
  67.     setatt(0);            /* Clear attributes */
  68.     if (taf != tas)
  69.         puttxt(tx, ty, taf, 0, title);
  70.     puttxt(ix, iy, iaf, iaf, ilinep);
  71.     puttxt(ix, iy, iaf, 0, ilined);
  72.     return(stat);
  73. }
  74.